package com.inossem.warehousestorage_inossem.activity.group_up_frame;

import com.inossem.warehousestorage_inossem.activity.base.BaseActivity;

/**
 * 作者：wsy on 2018/1/23 11:23
 * <p>
 * 邮箱：445979770@qq.com
 */

public class GroupUpFrameItemActivity extends BaseActivity {
//    private TextView title;
//
//    private PullToRefreshLayout refresh;
//
//    private PullableListView upFrameList;
//
//    private Button creat;
//
//    private GroupUpFrameItemListAdapter adapter;
//
//    private List<UpFrameManageBean.DataBean.UpFrameListBean> allData;
//
//    private String mCondition;
//
//    private boolean mFlag = false;
//
//    @Override
//    protected void onCreateImpl(Bundle savedInstanceState) {
//        setContentView(R.layout.activity_group_up_frame_item);
//        initView(GroupUpFrameItemActivity.this);
//        initData(GroupUpFrameItemActivity.this);
//    }
//
//    private void initView(Activity activity) {
//        title = (TextView) activity.findViewById(R.id.headerTitle);
//        upFrameList = (PullableListView) activity.findViewById(R.id.upFrameList);
//        refresh = (PullToRefreshLayout) activity.findViewById(R.id.upFrameRefresh);
//        creat = (Button) activity.findViewById(R.id.creatGroup);
//    }
//
//    private void initData(Activity activity) {
//        title.setText(R.string.activity_group_up_frame_item_title);
//        ActivityUtils.initBackAndFunction(activity, R.string.activity_main_title_short, new NoDoubleClickListener() {
//            @Override
//            public void onNoDoubleClick(View v) {
//                finish();
//            }
//        });
//        getExtra(activity);
//        if (mFlag) {
//            Intent intent = new Intent(activity, GroupUpFrameItemActivity.class);
//            startActivity(intent);
//            finish();
//        } else {
//            upFrameList.setPullUpFlag(false);
//            refresh.setOnRefreshListener(new PullToRefreshLayout.OnRefreshListener() {
//                @Override
//                public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
//                    initData(activity);
//                    pullToRefreshLayout.refreshFinish(PullToRefreshLayout.SUCCEED);
//                }
//
//                @Override
//                public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
//                }
//            });
//            mCondition = "";
//            getData(activity);
//            setmScanListener((String scanResult, int length) -> {
//                String type = QRCodeUtils.getQRCodeType(scanResult);
//                if (QRCodeConstant.TYPE_BATCH.equals(type)) {
//                    mCondition = QRCodeUtils.DecryptQRCode(scanResult, QRCodeConstant.PARAMETER_MATERIEL_CODE);
//                } else if (QRCodeConstant.TYPE_MATERIEL_CODE.equals(type)) {
//                    mCondition = QRCodeUtils.DecryptQRCode(scanResult);
//                }
//                getData(activity);
//            }, QRCodeConstant.TYPE_BATCH, QRCodeConstant.TYPE_MATERIEL_CODE);
//        }
//    }
//
//    private void getData(Context context) {
////        UpFrameManageRequest.request(context, mCondition, new GsonBeanListener<UpFrameManageBean>() {
////            @Override
////            public void onSuccess(UpFrameManageBean bean) {
////                allData = bean.getData().getUpFrameList();
////                if (allData.isEmpty()) {
////                    Utils.middleToast(context, getResources().getString(R.string.activity_in_storage_receive_list_no_message));
////                }
////                addUpFrameListData(context, ActivityUtils.getShowData(allData, 0), upFrameList, true);
////            }
////        });
//        List<String> list = new ArrayList<>();
//        for (int i = 0; i < 5; i++) {
//            list.add("100000000000");
//        }
//        if (list.size() == 0) {
////            DisplayMetrics metric = new DisplayMetrics();
////            getWindowManager().getDefaultDisplay().getMetrics(metric);
////            int width = metric.widthPixels;     // 屏幕宽度（像素）
////            int height = metric.heightPixels;   // 屏幕高度（像素）
////            LogUtils.i("height ======= " + (int)0.09*height);
//            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//            layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT , R.id.relativelayout);
//            layoutParams.setMargins(30, 0, 30, 0);//左上右下
//            creat.setLayoutParams(layoutParams);
//
//        }
//        allData = new ArrayList<>();
//        addUpFrameListData(list , context, ActivityUtils.getShowData(allData, 0), upFrameList, true);
//    }
//
//    private void addUpFrameListData(List<String> list , Context context, List<UpFrameManageBean.DataBean.UpFrameListBean> upFrameList, ListView listView, boolean flag) {
//        if (flag) {
//            adapter = new GroupUpFrameItemListAdapter(list , context, upFrameList, mCondition, (String condition) -> {
//                mCondition = condition;
//                getData(context);
//            });
//            listView.setAdapter(adapter);
//        }
//    }
//
//    public interface GroupUpFrameItemListener {
//        void onNoDoubleClickListener(String condition);
//    }
//
//    private void getExtra(Activity activity) {
//        mFlag = activity.getIntent().getBooleanExtra(UpFrameExtra.FLAG, false);
//    }
}
